﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using EluZSProvider;
using System.Web;
using System.Data;

namespace WebSys.UI.Control.ZhengShou
{
    public class ZS_DYRYLHControl : MPBasicTemplate
    {
        EluZSDataProvider _EluZSDataProvider = (EluZSDataProvider)ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
        public string userid = string.Empty;
        protected override void OnLoad(EventArgs e)
        {
            if (HttpContext.Current.Session["UserID"] == null)
            {
                Antu.Utilities.UtilitiesPage.AlertDialogClear("登录超时，请重新登录！", "window.parent.location.href('../login.aspx');");
            }
            else
            {
                userid = HttpContext.Current.Session["UserID"].ToString();
            }
            base.OnLoad(e);
            if (!base.Page.IsPostBack)
            {
                Bind();
            }
            CustomGridView CustomGridView1 = (CustomGridView)FindControl("CustomGridView1");
            CustomGridView1.OnLoadData+=new EventHandler(CustomGridView1_OnLoadData);
            Button Button2 = (Button)FindControl("Button2");
            Button2.Click += new EventHandler(Button2_Click);
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string strTYPE = base.Page.Request["TYPE"];
            if (strTYPE == "0")
            {
                base.Page.Response.Redirect("ChanQuanZhiHuanXieYiQianShu.aspx?PID=" + base.Page.Request["PID"] + "&ZID=" + base.Page.Request["ZID"] + "&ID=" + base.Page.Request["ID"] + "&FID=" + base.Page.Request["FID"] + "&action=edit");
            }
            else if (strTYPE == "1")
            {
                base.Page.Response.Redirect("HuoBiHuaBuChangXieYi.aspx?PID=" + base.Page.Request["PID"] + "&PERSONID=" + base.Page.Request["PERSONID"] + "&ID=" + base.Page.Request["ID"] + "&query=hbhbc");
            }
        }
        protected void Bind()
        {
            string strType = base.Page.Request["TYPE"];
            string strXYID = base.Page.Request["ID"];
            CustomGridView CustomGridView1 = (CustomGridView)FindControl("CustomGridView1");
            DataTable dt = _EluZSDataProvider.GetDYRYLH(strType, strXYID);//获取人员数据
            CustomGridView1.DataSource = dt;
            CustomGridView1.RecordCount = dt.Rows.Count;
            CustomGridView1.PageSize = 10;
            CustomGridView1.DataBind();
            
        }
        protected void CustomGridView1_OnLoadData(object sender, EventArgs e)
        {
            Bind();
        }
    }
}


